package com.lagou.config;

import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.http.converter.StringHttpMessageConverter;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import java.nio.charset.Charset;
import java.util.List;

@Configuration// 声明配置bean
@ComponentScan( basePackages = "com.lagou") // 包扫描
public class AppConfig {

}

//public class AppConfig implements WebMvcConfigurer {
//
//    @Override
//    public void extendMessageConverters(List<HttpMessageConverter<?>> converters) {
//        System.out.println("设置响应信息编码集......");
//        StringHttpMessageConverter stringHttpMessageConverter = (StringHttpMessageConverter) converters.get(1);
//        stringHttpMessageConverter.setDefaultCharset(Charset.forName("utf-8"));
//    }
//
//    @Override
//    public void addResourceHandlers(ResourceHandlerRegistry registry) {
//        System.out.println("提供静态资源的支持......");
//        //客户端以/html/开始的请求，访问类路径下static/html
//        registry.addResourceHandler("/html/**").addResourceLocations("classpath:/static/html/");
//    }
//}
